package com.iseastar.guojiang.newcabinet;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.iseastar.BaseActivity2;
import com.iseastar.guojiang.MainActivity;
import com.iseastar.guojiang.logic.AppLogic;
import com.iseastar.guojiang.model.ServiceTaskBean;
import com.shouhuobao.station.R;

/**
 * Created by lidandan on 2017/12/28.
 * 同城任务完成
 */
public class SameCityPickupCompleteActivity extends BaseActivity2 implements View.OnClickListener {

    private ServiceTaskBean serviceTaskBean = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        serviceTaskBean = (ServiceTaskBean) getIntent().getSerializableExtra("item");
        super.onCreate(savedInstanceState);
    }

    @Override
    protected void findViewById() {
        setContentView(R.layout.same_city_pickup_complete_activity);
        super.findViewById();
        getAppTitle().setCommonTitle("任务完成");
        findViewById(R.id.back_to_home_tv).setOnClickListener(this);
        findViewById(R.id.go_to_delivery_tv).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = null;
        switch (v.getId()) {
            //返回首页
            case R.id.back_to_home_tv:
                AppLogic.courierBackToHomeAndRefresh(getContext());
                finish();
                break;
            //前往送件
            case R.id.go_to_delivery_tv:
                if (serviceTaskBean != null) {
                    MainActivity.instance.refreshHomeData();
                    intent = new Intent(getContext(), SameCityTaskMainActivity.class);
                    intent.putExtra("item", serviceTaskBean);
                    startActivity(intent);
                    finish();
                }
                break;
        }
    }
}
